# import cv2
# import numpy as np
#
# # 读取图像
# image = cv2.imread('tk.jpeg', cv2.IMREAD_GRAYSCALE)
# if image is None:
#     print("Error: Unable to load image.")
#     exit()
#
# # 幂次变换
# gamma = 2.2  # 伽马值
# c = 255 / (np.max(image) ** gamma)  # 归一化系数
# power_transformed = c * (image ** gamma)
#
# # 转换为8位无符号整数
# power_transformed = np.uint8(power_transformed)
#
# # 显示原始图像和幂次变换后的图像
# cv2.imshow('Original Image', image)
# cv2.imshow('Power Transformed Image', power_transformed)
# cv2.waitKey(0)
# cv2.destroyAllWindows()